x=input('动物有几只：')
y=input('腿有几条：')

x=int(x)
y=int(y)

for i in range(x+1):
    if 2*i+4*(x-i)==y:
        print('there are {} chickens and {} rabbits'.format(i,x-i))
        break

